package com.ln.spring4X.configAndComponent;

import org.springframework.context.annotation.Bean;
import org.springframework.stereotype.Component;

@Component
public class HumanComponent {

    @Bean("getWomanByComponent")
    public Woman getWomanByComponent() {
        Woman woman = new Woman();
        // 直接调用@Bean注解的方法方法getChildBean()
        woman.setChild(getChildByComponent());
        return woman;
    }

    @Bean("getChildByComponent")
    public Child getChildByComponent() {
        return new Child();
    }

}
